import 'package:flutter/material.dart';

class Home extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text("层叠布局"), // 标题
          leading: Icon(Icons.menu), // 左侧图标
          actions: [Icon(Icons.settings)],  // 右侧图标数组
          elevation: 0.0,// 去掉阴影
          centerTitle: true, // 标题居中

        ),
        body:StackDemo()
    );
  }
}

class StackDemo extends StatelessWidget {


  @override
  Widget build(BuildContext context) {
    return Container(
      child: Stack(
        children: [
          CircleAvatar(
            backgroundImage: NetworkImage('https://pic1.zhimg.com/v2-c222feb701bcf1f5271d21ae6067e0e7_1440w.jpg?source=172ae18b'),
            radius: 200,
          ),
          Positioned(
              child: Container(
                color: Colors.red,
                padding: EdgeInsets.all(10),
                child: Text(
                  '热卖',
                  style: TextStyle(
                    color: Colors.white,
                    fontSize: 20
                  ),
                ),
              ),
            top: 50,
            right: 40,
          )
        ],
      ),
    );
  }
}
